package com.com.corejavalearnings.database;

import java.beans.PropertyVetoException;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Logger;

/**
 * Created by pankaj on 7/13/14.
 */
public class DataSourceExample {

    static Logger logger = Logger.getLogger(DataSourceExample.class.getName());

    static {
        logger.setParent(Logger.getLogger(DataSourceExample.class.getPackage().getName()));
    }

    public static void main(String[] args) throws InterruptedException, IOException, PropertyVetoException {

        logger.info("First Logging activity.");

        for(int i=0;i<100;i++){
            new Thread(new DataPersister("hibernate"),"Hibernate-"+ i).start();
            new Thread(new DataPersister("sherpa"),"Sherpa-" + i).start();
        }


        for(int i=0;i<100;i++){
            Thread.sleep(3000);
        }

        logger.info("Program Ended. ");
    }

}

